import logging

from databases import Database

from env_config import settings

__all__ = ['db']

# logging.basicConfig(level=logging.INFO)
logger = logging.getLogger('sql_logger')

db_url = settings.database_url

# 数据库实例
db: Database = Database(
    db_url,
    min_size=settings.database_pool_min_size,
    max_size=settings.database_pool_max_size,
    pool_recycle=settings.database_pool_recycle,
    echo=settings.database_echo,
)
